home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / etc / init.d / tails-detect-virtualization < prev    next >
Encoding:
Text File  |  2012-08-03  |  1.3 KB  |  57 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          tails-detect-virtualization
  4. # Required-Start:    mountkernfs $local_fs
  5. # Required-Stop:     $local_fs
  6. # Default-Start:     S
  7. # Default-Stop:      
  8. # Short-Description: Detect if we are running in a virtual machine
  9. # Description:       Detect if we are running in a virtual machine
  10. ### END INIT INFO
  11.  
  12. # Author: amnesia <amnesia@boum.org>
  13.  
  14. # PATH should only include /usr/* if it runs after the mountnfs.sh script
  15. PATH=/usr/sbin:/usr/bin:/sbin:/bin
  16. DESC="Detecting if we are running in a virtual machine"
  17. NAME=tails-detect-virtualization
  18. VIRTWHAT=/usr/sbin/virt-what
  19. SCRIPTNAME=/etc/init.d/$NAME
  20.  
  21. # Exit if virt-what is not installed
  22. [ -x "$VIRTWHAT" ] || exit 0
  23.  
  24. # Load the VERBOSE setting and other rcS variables
  25. . /lib/init/vars.sh
  26.  
  27. # Define LSB log_* functions.
  28. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
  29. # and status_of_proc is working.
  30. . /lib/lsb/init-functions
  31.  
  32. do_start()
  33. {
  34.     mkdir -p /var/lib/live
  35.     /bin/bash "${VIRTWHAT}" > /var/lib/live/detected-virtual-machine
  36. }
  37.  
  38. case "$1" in
  39.   start)
  40.     [ "$VERBOSE" != no ] && log_daemon_msg "$DESC" "$NAME"
  41.     do_start
  42.     case "$?" in
  43.         0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
  44.         2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
  45.     esac
  46.     ;;
  47.   restart|reload|stop|force-reload)
  48.     :
  49.     ;;
  50.   *)
  51.     echo "Usage: $SCRIPTNAME start" >&2
  52.     exit 3
  53.     ;;
  54. esac
  55.  
  56. :
  57.